/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package virtual.BD;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Rafael
 */
@Entity
@Table(name = "aluno_turma")
@NamedQueries({
    @NamedQuery(name = "AlunoTurma.findAll", query = "SELECT a FROM AlunoTurma a"),
    @NamedQuery(name = "AlunoTurma.findByCdAluno", query = "SELECT a FROM AlunoTurma a WHERE a.alunoTurmaPK.cdAluno = :cdAluno"),
    @NamedQuery(name = "AlunoTurma.findByCdTurma", query = "SELECT a FROM AlunoTurma a WHERE a.alunoTurmaPK.cdTurma = :cdTurma")})
public class AlunoTurma implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AlunoTurmaPK alunoTurmaPK;

    public AlunoTurma() {
    }

    public AlunoTurma(AlunoTurmaPK alunoTurmaPK) {
        this.alunoTurmaPK = alunoTurmaPK;
    }

    public AlunoTurma(int cdAluno, int cdTurma) {
        this.alunoTurmaPK = new AlunoTurmaPK(cdAluno, cdTurma);
    }

    public AlunoTurmaPK getAlunoTurmaPK() {
        return alunoTurmaPK;
    }

    public void setAlunoTurmaPK(AlunoTurmaPK alunoTurmaPK) {
        this.alunoTurmaPK = alunoTurmaPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (alunoTurmaPK != null ? alunoTurmaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AlunoTurma)) {
            return false;
        }
        AlunoTurma other = (AlunoTurma) object;
        if ((this.alunoTurmaPK == null && other.alunoTurmaPK != null) || (this.alunoTurmaPK != null && !this.alunoTurmaPK.equals(other.alunoTurmaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "virtual.BD.AlunoTurma[alunoTurmaPK=" + alunoTurmaPK + "]";
    }

}
